package meatslope2.gameengine.gameobjects.model;

import javax.microedition.khronos.opengles.GL10;

public class DrawableGameObject extends GameObject
{
	// ===========================================================
	// Members
	// ===========================================================
	
    // Size
    protected final int width;
    protected final int height;
    
    //Sprite to draw
    protected final Sprite sprite;
    
    //Whether or not draw relative to camera
    protected final boolean cameraEnabled;
    
    protected boolean draw = true;
    
	// ===========================================================
	// Getters/Setters
	// ===========================================================
	
    public int getWidth()
    {
    	return this.width;
    }
    
    public int getHeight()
    {
    	return this.height;
    }
    
	public boolean isCameraEnabled() 
	{
		return this.cameraEnabled;
	}
	
	public void setDraw(boolean draw)
	{
		this.draw = draw;
	}
    
	// ===========================================================
	// Constructors
	// ===========================================================
    
    public DrawableGameObject(Sprite sprite, int width, int height, boolean cameraEnabled)
    {
    	this.sprite = sprite;
    	
    	this.width = width;
    	this.height = height;
    	this.cameraEnabled = cameraEnabled;
    }
    
    public DrawableGameObject(Sprite sprite, int width, int height)
    {
    	this(sprite, width, height, true);
    }
    
	// ===========================================================
	// Methods for/from SuperClass/Interfaces
	// ===========================================================
    
    public void draw(GL10 pGL)
    {
    	if(this.draw)
    		sprite.draw(pGL, this);
    }
}
